import doctor from '@/router/doctor/doctor'
import request from '@/utils/request'

const name = '/admin/user/KywRoleController'

// 分页查询角色数据
export const pageKywRole = (pageNum, pageSize, doctor) => {
  return request({
    url: `${name}/pageKywRole/` + pageNum + "/" + pageSize,
    method: 'get',
    params: doctor
  })
}

// 添加角色
export const addKywRole = doctor => {
  return request({
    url: `${name}/addKywRole`,
    method: 'post',
    data: doctor,
  })
}

// 修改角色信息
export const updateKywRole = role => {
  return request({
    url: `${name}/updateKywRole`,
    method: 'put',
    data: role,
  })
}

// 根据id删除角色
export const deleteKywRole = id => {
  return request({
    url: `${name}/deleteKywRole/${id}`,
    method: 'delete',
  })
}

//查询全部角色及根据id查询用户的全部角色
export const GetRoleAll = (id) => {
  return request({
    url: `${name}/findRoleAll/${id}`,
    method: 'get',
  })
}

//查询所有的菜单数据及查询当前角色的菜单数据
export const findKywRoleMenuByRoleId = (roleId) => {
  return request({
    url: `${name}/findKywRoleMenuByRoleId/${roleId}`,
    method: 'get',
  })
}

// 角色添加权限菜单
export const addRoleMenu = role => {
  return request({
    url: `${name}/addRoleMenu`,
    method: 'post',
    data: role,
  })
}